package com.ehotting.edsta.diagnosisPredict.feign.factory;

import com.ehotting.eaf.core.web.domain.diagnosisPredict.PageDto;
import com.ehotting.eaf.core.web.domain.diagnosisPredict.Response;
import com.ehotting.edsta.diagnosisPredict.domain.dto.AlgoVersionFile;
import com.ehotting.edsta.diagnosisPredict.feign.AlgoTemplateFileFeignService;
import com.ehotting.edsta.diagnosisPredict.feign.AlgoVersionFileFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

/**
 * 轻量化算法参数历史版本的降级处理
 * 
 * @author edsta
 */
@Slf4j
@Component
public class AlgoVersionFileFallbackFactory implements FallbackFactory<AlgoVersionFileFeignService> {

    @Override
    public AlgoVersionFileFeignService create(Throwable throwable)
    {
        log.error("轻量化算法参数历史版本调用失败:{}", throwable.getMessage());
        return new AlgoVersionFileFeignService() {

            @Override
            public Response<PageDto<AlgoVersionFile>> pageList(Integer counts, String fileAlias, String fileName, String fileSize, String fileUrl, Integer id, Integer templateId, Date updateTime, String version) {
                return null;
            }

            @Override
            public Response<String> deleteByIds(String ids) {
                return null;
            }

            @Override
            public Response<AlgoVersionFile> getById(Long id) {
                return null;
            }

            @Override
            public Response<AlgoVersionFile> upload(MultipartFile file, Long id, Long templateId, String version) {
                return null;
            }

            @Override
            public feign.Response download(Long id) {
                return null;
            }
        };
    }
}
